<!DOCTYPE html>
<html lang="en">
<head>
	<script src="/static/js/dev.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!--bootstrap插件-->
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
	<link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
	<!--字体插件-->
	<link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
	<link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
	<!--ztree-->
	<link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
	<!--common-->
	<link href="/static/css/common.css" rel="stylesheet"/>
	<!--帮助手册样式-->
	<link rel="stylesheet" type="text/css" href="/static/css/help/document.css"/>
	<!--代码高亮-->
	<link type="text/css" rel="stylesheet" href="/static/plugin/SyntaxHighlighter/styles/shCore.css"/>
	<link type="text/css" rel="stylesheet" href="/static/plugin/SyntaxHighlighter/styles/shCoreDefault.css"/>
	<link type="text/css" rel="stylesheet" href="/static/plugin/SyntaxHighlighter/styles/shThemeDefault.css"/>
	<title>文件上传</title>

<script>

</script>
</head>

<body style="padding:5px 10px; box-sizing:border-box; background-color:white;">
<a href="#" target="_blank" class="showAtTop">显示单页</a>
<table class="docTable">
	<tr class="docTitle">
		<td colspan="2">
			<i class="fa fa-caret-down"> </i>&nbsp;&nbsp;&nbsp;&nbsp;文件上传
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<p>基于web uploader插件实现</p>
		</td>
	</tr>
</table>

<table class="docTable">
	<tr class="docTitle">
		<td colspan="2"><i class="fa fa-caret-down"> </i>属性（调用jo.uploadFile方法时通过第3个参数传入，请参考下面的实例）</td>
	</tr>

	<tr>
		<td><attr><string/>UPLOAD_FILE_TYPES</attr></td>
		<td>允许的文件类型</td>
	</tr>
	<tr>
		<td><attr><int/>fileNumLimit</attr></td>
		<td>文件数</td>
	</tr>
	<tr>
		<td><attr><int/>fileSingleSizeLimit</attr></td>
		<td>单个文件大小限制</td>
	</tr>
	<tr>
		<td><attr><obj/>xx</attr></td>
		<td>更多参数请参考web uploader官方文档</td>
	</tr>
</table>

<table class="docTable">
	<tr class="docTitle">
		<td colspan="2">
			<i class="fa fa-caret-down"> </i>方法
		</td>
	</tr>
	<tr>
		<td><func>jo.uploadFile(sUrl, callback, oParams)</func></td>
		<td>
			文件上传
			<br/> 基于web uploader插件实现
			<br/> @param sUrl 文件上传地址
			<br/> @param callback 文件上传回调,参数1是boolean类型,代表是否上传成功,参数2是file对象,参数3是后台返回结果
			<br/> @param oParams 详细配置项,参考webuploader官方api
		</td>
	</tr>
	<tr>
		<td><func>jo.closeUploadDialog()</func></td>
		<td>关闭文件上传窗口</td>
	</tr>
	<tr>
		<td><func><boolean/>xxx</func></td>
		<td>xxx</td>
	</tr>
	
</table>

<div class="eg">
	引入依赖：
	<pre name="code" class="brush:js;toolbar:false;">
		<!--上传插件-->
		&lt;link href="/static/plugin/webuploader-0.1.5/webuploader.css" rel="stylesheet">
		&lt;script src="/static/plugin/webuploader-0.1.5/webuploader.js">&lt;/script>
		&lt;script src="/static/js/upload.js">&lt;/script></pre>
	下面是代码生成中的导入功能示范：<input type="button" class="btn btn-primary btn-sm" value="导入配置" onclick="importConfig()">
	<pre name="code" class="brush:js;toolbar:false;">
		//导入配置，限制条件：后缀名为.gen，文件数量为1
		function importConfig(){
			jo.uploadFile("这里填url", function (success, file, json) {
				if(success && json.code == 0){
					jo.showMsg("上传成功!", {icon:1});
				}else{
					jo.showMsg("上传失败!", {icon:2});
				}
				jo.closeUploadDialog();//关闭文件上传窗口
			}, {UPLOAD_FILE_TYPES:'gen', fileNumLimit:1});
		}</pre>
</div>


</body>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>

<!--上传插件-->
<link href="/static/plugin/webuploader-0.1.5/webuploader.css" rel="stylesheet">
<script src="/static/plugin/webuploader-0.1.5/webuploader.js"></script>
<script src="/static/js/upload.js"></script>
<!--帮助手册js-->
<script src="/static/js/help/document.js"></script>
<!--代码高亮-->
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shCore.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushCSharp.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushPhp.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushJScript.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushJava.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushVb.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushSql.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushXml.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushDelphi.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushPython.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushRuby.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushCss.js"></script>
<script class="javascript" src="/static/plugin/SyntaxHighlighter/scripts/shBrushCpp.js"></script>
<script class="javascript">
	highLight();
	//导入配置，限制条件：后缀名为.gen，文件数量为1
	function importConfig(){
		jo.uploadFile("这里填url", function (success, file, json) {
			if(success && json.code == 0){
				jo.showMsg("上传成功!", {icon:1});
			}else{
				jo.showMsg("上传失败!", {icon:2});
			}
			jo.closeUploadDialog();//关闭文件上传窗口
		}, {UPLOAD_FILE_TYPES:'gen', fileNumLimit:1});
	}
</script>
</html>
